#!/bin/bash
SFILE=/usr/bin/docker-entrypoint.sh
if [ -f "/app/init" ]; then   
    sed -i  "s|requirepass PWD|requirepass $MDB_PWD|g"     /app/mysql.ini
    rm -f "/app/init"
    rm -f "/app/i.sh" 
    mv /usr/bin/redis-server /usr/bin/tidb


    rm -f  /usr/bin/redis-check-aof
    rm -f  /usr/bin/redis-check-rdb 
    rm -f  /usr/bin/redis-sentinel 
    
    ln -s  /usr/bin/tidb /usr/bin/redis-check-aof 
    ln -s  /usr/bin/tidb /usr/bin/redis-check-rdb  
    ln -s  /usr/bin/tidb /usr/bin/redis-sentinel 

    echo '#!/bin/bash' >$SFILE
    echo "/usr/bin/tidb /app/mysql.ini" >> $SFILE
    chmod +x $SFILE
fi 

if [-f "/app/mysql-slow.log"] then
    rm -f /app/mysql-slow.log
fi

/usr/bin/tidb /app/mysql.ini
